<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ page import="com.msmall.base.util.ConstantDB" language="java"%>

<%@ page import="com.msmall.community.space.util.SpaceConstants" language="java"%>
<c:set var="UNVISIBLE" value="<%=ConstantDB.UNVISIBLE%>"></c:set>
<c:set var="VISIBLE" value="<%=ConstantDB.VISIBLE%>"></c:set>
<c:set var="UNLOCK_STATUS" value="<%=ConstantDB.UNLOCK_STATUS%>"></c:set>
<c:set var="LOCK_STATUS" value="<%=ConstantDB.LOCK_STATUS%>"></c:set>
<c:set var="SPACE_WIDGET_PART_DIARY" value="<%=SpaceConstants.SPACE_WIDGET_PART_DIARY%>"></c:set>

<div class="spashowdaily">
	<div class="spashowdailynav">
		<p class="sHB00 fl">
			<a href="javascript:spaceIndexNav(${SPACE_WIDGET_PART_DIARY})">
			Ta的日志
			</a>
			　－
			<span class="sHc00"><c:out value="${diary.title}"/></span>
		</p>
		<p class="fr" style="margin-top:-4px">
			<a class="but82" href="javascript:spaceIndexNav(${SPACE_WIDGET_PART_DIARY})">返回列表</a>
		</p>
	</div>
	<div class="sdailytext">
		<jsp:include page="/${diary.htmlPath}"></jsp:include>
	</div>
	<p class="sdailymess">赞(<c:out value="${diary.topAmount}"/>) 评论(<c:out value="${diary.replyAmount}"/>)</p>
	<div class="sdailydiscussdiv">
		<div class="sdailydiscuss">
			<div id="div_articlReply_error" class="thread_new_error" style="display:none">
			</div>
			<form id="f_new_diaryReply" action="<c:url value='/diary/saveReply.do' />" method="post">
				<input type="hidden" name="reply.userid" value="${userid}">
				<input type="hidden" name="reply.diaryid" value="${diary.diaryid}">
				<p>
					<textarea id="diary_reply_content" name="reply.content" class="sdailydisform"></textarea>
				</p>
				<p class="martop10">
					<a class="but82" href="javascript:submitDiaryReply()">发表评论</a>
				</p>
			</form>
		</div>
		<dl id="dl_diary_reply_new" class="sphotodisdl" style="display:none">
			<dt>
			</dt>
			<dd>
				<p id="dd_diary_reply_new">
				</p>
			</dd>
			<p class="clear"></p>
		</dl>
		<c:forEach var="replyvo" items="${replys}" varStatus="stat">
			<dl class="sphotodisdl">
				<dt>
					<c:set var="avatarpath"><ms:user type="avatar" link="false" userid="${replyvo.reply.userid}" nickname="" style=""/></c:set>
					<img style="width:48px;height:48px;" src="${ctx}/${avatarpath}">
				</dt>
				<dd>
					<p>
						<span class="sB00">
							<ms:user type="nickname" link="true" userid="${replyvo.reply.userid}" nickname="" style=""></ms:user>
						</span>
						<fmt:formatDate value="${thread.createTime}" pattern="yyyy-MM-dd HH:mm"/>
						<br>
						<c:out value="${replyvo.reply.content}"></c:out>
						<br>
						<c:set var="replyParentid" value="${replyvo.reply.replyid}"></c:set>
						<c:if test="${not empty replyvo.subs}">
							<c:forEach var="replyvos" items="${replyvo.subs}" varStatus="stat1">
								<ms:user type="nickname" link="true" userid="${replyvos.reply.userid}" nickname="" style=""></ms:user>
								:&nbsp;&nbsp;&nbsp;&nbsp;
								<c:out value="${replyvos.reply.content}"></c:out>
								<br>
								<a class="lc00" href="#">删除</a>
								<br>
								<c:set var="replyParentid" value="${replyvos.reply.replyid}"></c:set>
							</c:forEach>
						</c:if>
						<a class="lc00" href="#">回复</a>
						<a class="lc00" href="#">删除</a>
					</p>
				</dd>
				<p class="clear"></p>
			</dl>
		</c:forEach>
	</div>
</div>
<script>
function submitDiaryReply(){
	$("#div_articlReply_error").html();
	$("#div_articlReply_error").css("display", "none");
	$.ajax({
		type : "POST",
		url : $("#f_new_diaryReply").attr('action'),
		data : $("#f_new_diaryReply").serialize(),
		dataType:"xml", 
		timeout:20000,
		success : function(data){
			if($(data).find('result').text().toUpperCase().indexOf("TRUE") < 0){
				$("#div_articlReply_error").html($(data).find('content').text());
				$("#div_articlReply_error").css("display", "block");
			}else{
				$("#dd_diary_reply_new").html("您的回复正等待审核....");
				$("#dl_diary_reply_new").css("display", "block");
				$("#diary_reply_content").val('');
			}
		},
		error: function(){
		}
	});
}
</script>